package ch.trackedbean.loaders.internal;

import java.util.*;

/**
 * General loader service interface. This interface is not intended to be implemented directly, implement only specific subclasses of it.<br>
 * The values of {@link #getType()} and {@link #isSuperLoader()} were used to figure out the correct loader for a request.<br>
 * <br>
 * To register loader services create simply a service provider file for the concrete service interface (so for a subclass of this interface and NOT this
 * interface itself):<br>
 * Thus is a <code>META-INF/services/&lt;X extends ILoaderService&gt;</code> file containing the fully qualified names of the service implementations.<br>
 * <br>
 * See {@link ServiceLoader} for further information about service providing.
 * 
 * @param <T> The type which is handled by this loader
 * @author M. Hautle
 */
public interface ILoaderService<T> {
    /**
     * Returns the type which can be handled by this loader.
     * 
     * @return The loaded type
     */
    Class<T> getType();

    /**
     * Returns wherever this loader supports just the concrete type returned by {@link #getType()} (false) or also it's subtypes (true).
     * 
     * @return True if this loader supports also subclasses of {@link #getType()}
     */
    boolean isSuperLoader();
}
